package com.yunkaweilai.android.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.TextView;

import com.yunkaweilai.android.R;

/**
 * Created by Administrator on 2017/8/8.
 */

public class ChoiceView extends FrameLayout implements Checkable {


    private TextView mTextView;
    private CheckBox mCheckbox;
    public ChoiceView(@NonNull Context context) {
        super(context);
        View.inflate(context, R.layout.item_list_single_check, this);
        mTextView = (TextView) findViewById(R.id.id_tv_name);
        mCheckbox = (CheckBox) findViewById(R.id.id_checkbox);
    }

    public void setText(String text) {
        mTextView.setText(text);
    }

    @Override
    public void setChecked(boolean checked) {
        mCheckbox.setChecked(checked);
    }

    @Override
    public boolean isChecked() {
        return mCheckbox.isChecked();
    }

    @Override
    public void toggle() {
        mCheckbox.toggle();
    }
}
